﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DelegateDemo2
{
    class Program
    {
        public static bool DataComparer(object a, object b)
        {
            return ((Student)a).BirthDay > ((Student)b).BirthDay;
        }

        static void Main(string[] args)
        {
            Student a = new Student { Name = "Ivan", BirthDay = new DateTime(1987,7,11) };
            Student b = new Student { Name = "Andriy", BirthDay = new DateTime(1988, 7, 11) };
            Student d = new Student { Name = "Alex", BirthDay = new DateTime(1969, 7, 11) };
            Student c = new Student { Name = "Oleg", BirthDay = new DateTime(1989, 7, 11) };

            

            Student[] arr = new Student[] { a, b, c, d };           

            MySorter.Sort(arr, new SortComparer(DataComparer));

            foreach (Student s in arr)
            {
                Console.WriteLine(s);
            }

        }
    }
}
